<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>上架商品列表</title>
    <link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
    <!--查询表单-->
    <form class="layui-form" action="list_page_condition.do">
        <div class="layui-inline">
            <div class="layui-input-inline layui-input-wrap">
                <input type="text" name="productName" lay-verify="required"  lay-reqtext="请输入商品名称" lay-affix="clear" class="layui-input" placeholder="请输入商品名称">
            </div>
            <div class="layui-input-inline">
                <select name="productType" lay-filter="product_type">
                    <option value="" selected>商品类型</option>
                    <option value="0" >电器</option>
                    <option value="1" >服装</option>
                    <option value="2">图书</option>
                    <option value="3">手机</option>
                    <option value="4">笔记本</option>
                </select>
            </div>
            <div class="layui-input-inline layui-input-wrap">
                <button type="button" class="layui-btn" lay-on="get-vercode">查询</button>
            </div>
        </div>
    </form>

    <!--数据表格-->
    <table class="layui-table" id="productTbl" lay-filter="test" style="width: 98%;">
    </table>


    <script type="text/html" id="barDemo">
        <div class="layui-clear-space">
            <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
            <a class="layui-btn layui-btn-xs" lay-event="more">
                更多
                <i class="layui-icon layui-icon-down"></i>
            </a>
        </div>
    </script>


    <script type="text/html" id="optionBar">

        {{#  if(d.productStatus === 1){ }}
        <a class="layui-btn layui-btn-danger layui-btn-xs layui-bg-red" lay-event="down">下架</a>
        {{#  } }}
        {{#  if(d.productStatus === 0){ }}
        <a class="layui-btn layui-btn-danger layui-btn-xs layui-bg-orange" lay-event="up">上架</a>
        {{#  } }}

        <a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="show">修改</a>

        <a class="layui-btn layui-btn-xs " lay-event="detail">查看详情</a>


    </script>

    <!--设置表格中复选框显示商品上架状态-->
    <script type="text/html" id="status-switch">
        <!-- d 表示当前行 -->
        <input type="checkbox" name="status"
               value="{{= d.productId }}"
               title="上架|下架" lay-skin="switch"
               lay-filter="demo-templet-status"
               {{= d.productStatus == "1" ? "checked" : "" }}>
    </script>

    <!--修改商品表单-->
    <div id="updateContainer" style="display: none">
        <form class="layui-form" id="updateForm" lay-filter="updateForm" style="margin: 1rem">

            <div class="layui-form-item">
                <label class="layui-form-label">商品编号</label>
                <div class="layui-input-block">
                    <input type="text" id="update-productId" name="productId"
                           autocomplete="off" class="layui-input" />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">商品名称</label>
                <div class="layui-input-block">
                    <input type="text" id="update-productName" name="productName"
                           autocomplete="off" class="layui-input" />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">商品类型</label>
                <div class="layui-input-block">
                    <select name="productType" id="update-type" lay-filter="type" lay-search="">
                        <option value="">请选择类型</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">商品价格</label>
                <div class="layui-input-block">
                    <input type="text" id="update-productPrice" name="productPrice"
                           autocomplete="off" class="layui-input" />
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">状态</label>
                <div class="layui-input-block">
                    <input type="radio" id="update-productStatus1" name="productStatus"
                           value="1" title="上架" checked>
                    <input type="radio" id="update-productStatus2" name="productStatus"
                           value="0" title="下架">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
          <textarea id="update-productDesc" name="productDesc"
                    placeholder="请输入内容" class="layui-textarea">
      </textarea>
                </div>
            </div>
        </form>
    </div>

</body>
<script src="layui/layui.js"></script>
<script src="js/product_on.js"></script>
</html>